package com.springboot.securtiy.server.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
public class UserServerImpl implements UserDetailsService {
    @Autowired
    private PasswordEncoder password1;
    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {

        User user = new User("dev",password1.encode("123"), AuthorityUtils.createAuthorityList());
        return user;
    }
}
